package com.jf.blogbackened.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.OSS;
import com.jf.blogbackened.bean.Result;
import com.jf.blogbackened.utils.OSSUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

@RestController
public class UploadController {
    @RequestMapping("/upload")
    public String upload(MultipartFile file){
        String path = OSSUtil.putObject(file);
        Result ok = Result.ok(path);
        return JSON.toJSONString(ok);

    }


}
